<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../included/commons.jsp"%>
<link href="${base}javascript/jquerys/jquery.uploadify-v2.1.0/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="${base }javascript/jquerys/jquery.uploadify-v2.1.0/swfobject.js"
></script>
<script type="text/javascript"
src="${base}javascript/jquerys/jquery.uploadify-v2.1.0/jquery.uploadify.v2.1.0.min.js"
></script>


<input name="upLoad" type="file" id="theupfile"/>
<div id='output1'></div>
<script type="text/javascript">
   	$(function(){
   		$('#theupfile').uploadify({
   			'uploader'  : '${base}javascript/jquerys/jquery.uploadify-v2.1.0/uploadify.swf',
   			'auto'      : false,
   			'fileDesc'  : 'Office模版文件word,或者excel',
   			'fileExt'   : '*.doc;*.docx;*.xls;*.xlsx',
   			'script'    : '${base}addmsoffice.action',
   		     //'queueID'   : 'fileQueue',
   			//'buttonText': '选择模版',
   			'displayData'    : 'speed',
   			'fileDataName':'upLoad',
   			'cancelImg' : '${base}javascript/jquerys/jquery.uploadify-v2.1.0/cancel.png',
   			'multi'     : true,
   			'method'    :'POST',
   			onComplete: function(event,queueID,fileObj,response,data){
   				$("#output1").append("文件 :"+fileObj.name+"上传完毕!<br/>");
   			},
   			onAllComplete:function(event,data){
               // alert(data.filesUploaded);
   			   //$.jGrowl("文件上传完毕,共"+data.filesUploaded+"个"); 
    			$("#output1").append("文件上传完毕,共"+data.filesUploaded+"个");   
   	   		},
   	   		onError :function(event,queueID,fileObj,errorObj){
   	   		    alert("文件上传错误 <br/>"+errorObj.info);  
   	   	   	}
   			});

     tbar.removeAll(true);
   	 tbar.addButton([{text:'返回模版列表',handler:function(){
         doAjaxLink('${base}listoffices.action');
 	 }},
 	    {text:'上传模版',handler:function(){
 		    $('#theupfile').uploadifyUpload();
 		   $("#output1").empty();
         }},
         {text:'清理所选',handler:function(){
 		    $('#theupfile').uploadifyClearQueue();
         }}
         
 	 ]);
      tbar.render(); 
   	 });
</script>